

package com.kimo.shop.user.comment.dao;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.kimo.shop.bean.param.CustomerReqParam;
import com.kimo.shop.common.util.PageParam;
import com.kimo.shop.user.comment.dto.UserBalanceLogDto;
import com.kimo.shop.user.comment.model.UserBalanceLog;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 余额充值记录
 *
 * @author kimo-taozhouchuan
 * @date 2020-09-09 17:38:30
 */
public interface UserBalanceLogMapper extends BaseMapper<UserBalanceLog> {

    PageParam<UserBalanceLogDto> getLogPage(PageParam<UserBalanceLogDto> page, @Param("userId") String userId);

    Double countUserRechargeAmount(@Param("userId") String userId);

    Integer countUserRechargeNum(@Param("userId") String userId);

    Date getRecentRechargeTime(@Param("userId") String userId);

    /** 平台查询某个用户的余额明细*/
    IPage<UserBalanceLog> getPageByUserId(PageParam<UserBalanceLog> page, @Param("userId") String userId);

    List<String> listUserIdByRechargeAmount(@Param("isPayed") Integer isPayed,
                                            @Param("startDate") Date startDate,
                                            @Param("endDate") Date endDate,
                                            @Param("minAmount") BigDecimal minAmount,
                                            @Param("maxAmount") BigDecimal maxAmount);

    List<String> listUserIdByRechargeNum(@Param("isPayed") Integer isPayed,
                                         @Param("startDate") Date startDate,
                                         @Param("endDate") Date endDate,
                                         @Param("minNum") Long minNum,
                                         @Param("maxNum") Long maxNum);

    /**
     * 时间段类，进行充值的会员人数，同一个人多次充值计为1
     * @param param 参数
     * @return
     */
    int countUserRechargeNumByDateRange(@Param("param") CustomerReqParam param);
}
